import 'package:flutter/cupertino.dart';

/// code : "string"
/// data : {"id":0,"ada":"string","amwayId":"string","moduleItemList":[{"moduleName":"NONE","no":0,"state":"ON"}],"theme":"string"}
/// message : "string"

class ModuleList {
  String _code;
  ModuleData _data;
  String _message;

  String get code => _code;
  ModuleData get data => _data;
  String get message => _message;

  ModuleList({String code, ModuleData data, String message}) {
    _code = code;
    _data = data;
    _message = message;
  }

  ModuleList.fromJson(dynamic json) {
    _code = json["code"];
    _data = json["data"] != null ? ModuleData.fromJson(json["data"]) : null;
    _message = json["message"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["code"] = _code;
    if (_data != null) {
      map["data"] = _data.toJson();
    }
    map["message"] = _message;
    return map;
  }
}

/// id : 0
/// ada : "string"
/// amwayId : "string"
/// moduleItemList : [{"moduleName":"NONE","no":0,"state":"ON"}]
/// theme : "string"

class ModuleData {
  String _id;
  String _ada;
  String _amwayId;
  List<ModuleItem> _moduleItemList;
  String _theme;

  String get id => _id;
  String get ada => _ada;
  String get amwayId => _amwayId;
  List<ModuleItem> get moduleItemList => _moduleItemList;
  String get theme => _theme;

  ModuleData(
      {String id,
      String ada,
      String amwayId,
      List<ModuleItem> moduleItemList,
      String theme}) {
    _id = id;
    _ada = ada;
    _amwayId = amwayId;
    _moduleItemList = moduleItemList;
    _theme = theme;
  }

  ModuleData.fromJson(dynamic json) {
    _id = json["id"];
    _ada = json["ada"];
    _amwayId = json["amwayId"];
    if (json["moduleItemList"] != null) {
      _moduleItemList = [];
      json["moduleItemList"].forEach((v) {
        _moduleItemList.add(ModuleItem.fromJson(v));
      });
    }
    _theme = json["theme"];
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["id"] = _id;
    map["ada"] = _ada;
    map["amwayId"] = _amwayId;
    if (_moduleItemList != null) {
      map["moduleItemList"] = _moduleItemList.map((v) => v.toJson()).toList();
    }
    map["theme"] = _theme;
    return map;
  }
}

/// moduleName : "COMBINATION"
/// no : 1
/// state : "ON"
/// showOfficialFlag : "ON"
/// moduleLink : "www.person.com"
/// name : "精选组合"
/// auditStatusEnum : "UN_PASS"

class ModuleItem {
  String _moduleName;
  int _no;
  Key _key;

  Key get key => _key;

  set key(Key value) {
    _key = value;
  }

  set no(int value) {
    _no = value;
  }

  String _state;
  String _showOfficialFlag;
  String _moduleLink;
  String _name;
  String _auditStatusEnum;

  set state(String value) {
    _state = value;
  }

  bool _actionState;

  bool get actionState => _actionState;

  set actionState(bool value) {
    _actionState = value;
  }

  String get moduleName => _moduleName;
  int get no => _no;
  String get state => _state;
  String get showOfficialFlag => _showOfficialFlag;
  String get moduleLink => _moduleLink;
  String get name => _name;
  String get auditStatusEnum => _auditStatusEnum;

  ModuleItem({
    String moduleName,
    int no,
    String state,
    String showOfficialFlag,
    String moduleLink,
    String name,
    String auditStatusEnum}){
    _moduleName = moduleName;
    _no = no;
    _state = state;
    _showOfficialFlag = showOfficialFlag;
    _moduleLink = moduleLink;
    _name = name;
    _auditStatusEnum = auditStatusEnum;
    _key=ValueKey(_name);
  }

  ModuleItem.fromJson(dynamic json) {
    _moduleName = json["moduleName"];
    _no = json["no"];
    _state = json["state"];
    _showOfficialFlag = json["showOfficialFlag"];
    _moduleLink = json["moduleLink"];
    _name = json["name"];
    _auditStatusEnum = json["auditStatusEnum"];
    _key=ValueKey(_name);
  }

  Map<String, dynamic> toJson() {
    var map = <String, dynamic>{};
    map["moduleName"] = _moduleName;
    map["no"] = _no;
    map["state"] = _state;
    map["showOfficialFlag"] = _showOfficialFlag;
    map["moduleLink"] = _moduleLink;
    map["name"] = _name;
    map["auditStatusEnum"] = _auditStatusEnum;
    return map;
  }

}
